<style>
@media print {
  ._wz_vehicleDetails {
    -webkit-print-color-adjust: exact;
    height: inherit !important;
    font-size: 12px !important;
  }
}
</style>
<template>
  <div ref="vehicleDetails" class="_wz_vehicleDetails" id="_wz_vehicleDetails">
    <Form>
      <table cellpadding="0" cellspacing="0" border="0">
        <colgroup>
          <col width="13%">
          <col width="20%">
          <col width="13%">
          <col width="20%">
          <col width="13%">
          <col width="20%">
        </colgroup>
        <tbody>
        <tr>
          <td style="font-weight: 600;position:relative;" colspan="6">
            基本信息
            <Button type="primary" @click="printTest" class="no-print" style="position: absolute;right: 10px;top: 4px;">
              打印
            </Button>
          </td>
        </tr>
        <tr>
          <td colspan="2" rowspan="3">
            <div class="demo-upload-list">
              <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                <img :src="!!formData.vehicleImg?apiUrl.imgUrl+formData.vehicleImg:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
              </viewer>
            </div>
          </td>
          <td style="text-align: right;font-weight: 600;">自编号</td>
          <td>{{!!formData.customNo ? formData.customNo : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">车牌号</td>
          <td>{{!!formData.carPlateNo ? formData.carPlateNo : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">车架号</td>
          <td>{{!!formData.frameNo ? formData.frameNo : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">车牌颜色</td>
          <td>
            <template v-if="!!formData.carPlateColor">
              <template v-if="formData.carPlateColor == 1">蓝色</template>
              <template v-else-if="formData.carPlateColor == 2">黄色</template>
              <template v-else-if="formData.carPlateColor == 3">黑色</template>
              <template v-else-if="formData.carPlateColor == 4">白色</template>
              <template v-else-if="formData.carPlateColor == 5">绿色</template>
              <template v-else-if="formData.carPlateColor == 93">黄绿色</template>
              <template v-else-if="formData.carPlateColor == 9">其他</template>
            </template>
            <template v-else>--</template>
          </td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">发动机号</td>
          <td>{{!!formData.vehicleEngineNo ? formData.vehicleEngineNo : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">车辆类型</td>
          <td>{{!!formData.vehicleType ? formData.vehicleType : '--'}}</td>

        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">车主/业户</td>
          <td>{{!!formData.vehicleOwnerName ? formData.vehicleOwnerName : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">车主电话</td>
          <td>{{!!formData.vehicleOwnerPhone ? formData.vehicleOwnerPhone : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">货运类型</td>
          <td>{{!!formData.transportValue ? formData.transportValue : '--'}}</td>

        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">车主住址</td>
          <td colspan="3">{{!!formData.vehicleOwnerAddress ? formData.vehicleOwnerAddress : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">营运证号</td>
          <td>{{!!formData.vehicleOperationCertificateNo ? formData.vehicleOperationCertificateNo : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">联系人</td>
          <td>{{!!formData.vehicleContactsName ? formData.vehicleContactsName : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">联系电话</td>
          <td>{{!!formData.vehicleContactsPhone ? formData.vehicleContactsPhone : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">初登日期</td>
          <td>{{!!formData.vehicleDrivingPermitRegisterDate ? formData.vehicleDrivingPermitRegisterDate : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">家庭住址</td>
          <td colspan="3">{{!!formData.vehicleContactsAddress ? formData.vehicleContactsAddress : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">发证日期</td>
          <td>{{!!formData.vehicleDrivingPermitIssueDate ? formData.vehicleDrivingPermitIssueDate : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">实际住址</td>
          <td colspan="3">{{!!formData.vehicleContactsLocation ? formData.vehicleContactsLocation : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">到期日期</td>
          <td>{{!!formData.vehicleDrivingPermitExpireDate ? formData.vehicleDrivingPermitExpireDate : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">运输企业</td>
          <td colspan="5">{{!!formData.deptName ? formData.deptName : '--'}}</td>
        </tr>
        <tr>
          <td style="font-weight: 600;" colspan="6">车辆状态</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">入网状态</td>
          <td colspan="2">
            <Tag color="warning" type="dot" v-if="formData.internetState == 0">未入网</Tag>
            <Tag color="success" type="dot" v-if="formData.internetState == 1">已入网</Tag>
            <Tag color="error" type="dot" v-if="formData.internetState == 2">超时入网</Tag>
          </td>
          <td style="text-align: right;font-weight: 600;">动态监管</td>
          <td colspan="2">
            <Tag color="warning" type="dot" v-if="formData.monitorState == 0">未绑定</Tag>
            <Tag color="success" type="dot" v-if="formData.monitorState == 1">已绑定</Tag>
          </td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">主动安全</td>
          <td colspan="2">
            <Tag color="warning" type="dot" v-if="formData.internetState == 0">未开启</Tag>
            <Tag color="success" type="dot" v-if="formData.internetState == 1">已开启</Tag>
          </td>
          <td style="text-align: right;font-weight: 600;">行驶证状态</td>
          <td colspan="2">
            <Tag color="error" type="dot" v-if="formData.permitState == 0">已到期</Tag>
            <Tag color="success" type="dot" v-if="formData.permitState == 1">未到期</Tag>
            <Tag color="warning" type="dot" v-if="formData.permitState == 2">即将到期</Tag>
            <Tag color="" type="dot" v-if="formData.permitState == -1">未知</Tag>
          </td>
        </tr>

        <tr>
          <td style="font-weight: 600;" colspan="6">详细信息</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">车辆品牌</td>
          <td>{{ !!formData.vehicleBrand ? formData.vehicleBrand : '--' }}</td>
          <td style="text-align: right;font-weight: 600;">车辆型号</td>
          <td>{{ !!formData.vehicleModel ? formData.vehicleModel : '--' }}</td>
          <td style="text-align: right;font-weight: 600;">燃料类型</td>
          <td>{{ !!formData.fuelType ? formData.fuelType : '--' }}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">排放标准</td>
          <td>{{ !!formData.vehicleEmissionStandards ? formData.vehicleEmissionStandards : '--' }}</td>
          <td style="text-align: right;font-weight: 600;">核定总质量</td>
          <td>{{ !!formData.vehicleWeight ? formData.vehicleWeight : '--' }}</td>
          <td style="text-align: right;font-weight: 600;">核定载质量</td>
          <td>{{ !!formData.vehiclePermitWeight ? formData.vehiclePermitWeight : '--' }}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">准牵引质量</td>
          <td>{{ !!formData.vehicleTowWeight ? formData.vehicleTowWeight : '--' }}</td>
          <td colspan="4"></td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">备注</td>
          <td colspan="5" style="min-height:50px;padding:5px 10px;">{{!!formData.remark ? formData.remark : '--'}}</td>
        </tr>
        <tr>
          <td style="font-weight: 600;" colspan="6">相关照片</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">行驶证照片</td>
          <td colspan="2">
            <div class="demo-upload-list">
              <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                <img :src="!!formData.vehicleLicenseImg?apiUrl.imgUrl+formData.vehicleLicenseImg:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
              </viewer>
            </div>
          </td>
          <td style="text-align: right;font-weight: 600;">营运证照片</td>
          <td colspan="2">
            <div class="demo-upload-list">
              <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                <img :src="!!formData.vehicleOperationCertificateImg?apiUrl.imgUrl+formData.vehicleOperationCertificateImg:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
              </viewer>
            </div>
          </td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">车辆资料</td>
          <td colspan="5">
            <div style="min-height:50px;">
              <div style="width: 200px;overflow: hidden;display: inline-block;margin-right: 4px;" v-for="item,index in formData.imgEntityList">
                <div class="demo-upload-list">
                  <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                    <img :src="!!item.imgUrl?item.imgUrl:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
                  </viewer>
                </div>
                <div style="line-height: 30px;text-align: center;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;height: 30px;background: #f3f3f3;border-radius: 4px;">
                  {{ item.imgName }}
                </div>
              </div>
            </div>
          </td>
        </tr>
        </tbody>
      </table>
    </Form>


  </div>
</template>
<script>
export default {
  props: ['selectData'],//接收来自父组件的数据
  data() {
    return {
      formData: {},//车辆数据
    }
  },
  beforeCreate() {//beforeCreate创建前状态

  },
  created() {//created创建完毕状态

  },
  beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

  },
  mounted() {//mounted 挂载结束状态
    let that = this;
    //车辆修改详情
    that.axios.post(that.apiUrl.coreVehicleCoreVehicleInfo, {uuid: that.selectData.uuid}).then(res => {
      that.spinShow = false;
      if (!!res) {
        var data  = res.data.data;//表单
        data.govState = !!data.govState?data.govState:0
        that.formData = data;

        let imgList = [];
        res.data.data.coreVehicleImgList.forEach((k, i) => {
          k.imgUrl = that.apiUrl.imgUrl + k.imgUrl
          imgList.push(k);
        })
        that.formData.imgEntityList = imgList;//res.data.data;//多图回显
      }
    }).catch(err => {
      console.log("失败", err)
    })
  },
  methods: {//执行的方法
    printTest() {
      this.$print(this.$refs.vehicleDetails) // 使用
    },

  },
  watch: {//监听

  },
  beforeUpdate() {//beforeUpdate 更新前状态

  },
  updated() {//updated 更新完成状态

  },
  beforeDestroy() {//beforeDestroy 销毁前状态

  },
  destroyed() {//destroyed 销毁完成状态

  }
}
</script>
<style lang="less">
._wz_vehicleDetails {

  table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 12px !important;

    td {
      min-width: 0;
      height: 40px;
      box-sizing: border-box;
      text-align: left;
      text-overflow: ellipsis;
      border: 1px solid #515a6e;
      padding: 0 10px;
      word-break: break-word;
    }
  }

  .demo-upload-list {
    margin: 5px auto;
    width: 200px;
    height: 140px;
    text-align: center;
    line-height: 140px;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    position: relative;

    img {
      min-height: 30%;
      max-height: 90%;
      min-width: 30%;
      max-width: 90%;
      //width: 100%;
      //height: 100%;
    }
  }


}

</style>
